package com.wanxi.service.impl;

import com.wanxi.dao.ClothingStyleDao;
import com.wanxi.model.ClothingStyleModel;
import com.wanxi.model.ResultModel;
import com.wanxi.service.ClothingStyleService;
import com.wanxi.util.SnowflakeIdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 杨金乾
 */
@Service
public class ClothingStyleServiceImpl implements ClothingStyleService {
    @Autowired
    ClothingStyleDao clothingStyleDao;


    @Override
    public ResultModel enable(ClothingStyleModel clothingStyleModel) {
        return ResultModel.getResult(clothingStyleDao.enable(clothingStyleModel));
    }

    @Override
    public ResultModel add(ClothingStyleModel clothingStyleModel) {
        SnowflakeIdWorker snowflakeIdWorker=new SnowflakeIdWorker(WorkId.WORK_ID);
        clothingStyleModel.setId(snowflakeIdWorker.nextId());
        return ResultModel.getResult(clothingStyleDao.add(clothingStyleModel));
    }

    @Override
    public ResultModel update(ClothingStyleModel clothingStyleModel) {
        return ResultModel.getResult(clothingStyleDao.update(clothingStyleModel));
    }

    @Override
    public ResultModel delete(ClothingStyleModel clothingStyleModel) {
        return ResultModel.getResult(clothingStyleDao.delete(clothingStyleModel));
    }

    @Override
    public ResultModel findById(ClothingStyleModel clothingStyleModel) {
        return ResultModel.getResult(clothingStyleDao.findById(clothingStyleModel));
    }

    @Override
    public ResultModel findAll(ClothingStyleModel clothingStyleModel) {

        return ResultModel.getResult(
                clothingStyleDao.findAll(clothingStyleModel),
                clothingStyleDao.count(clothingStyleModel));
    }

    @Override
    public ResultModel count(ClothingStyleModel clothingStyleModel) {
        return ResultModel.getResult(clothingStyleDao.count(clothingStyleModel));
    }

    @Override
    public ResultModel isShow(ClothingStyleModel clothingStyleModel) {
        return ResultModel.getResult(clothingStyleDao.isShow(clothingStyleModel));
    }

    @Override
    public ResultModel isRecommend(ClothingStyleModel clothingStyleModel) {
        return null;
    }

    @Override
    public ResultModel whereShow(ClothingStyleModel clothingStyleModel) {
        return null;
    }
}
